<%--
  Created by IntelliJ IDEA.
  User: 86134
  Date: 2024/10/14
  Time: 14:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="entity.Pet" %>
<%@ page import="dao.PetDao" %>
<%@ page import="dao.PetDaoImpl" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>宠物列表</title>
</head>
<body>
    <h2>宠物列表</h2>
    <table border="1">
        <tr>
            <th>ID</th>
            <th>宠物名称</th>
            <th>宠物品种</th>
            <th>宠物性别</th>
            <th>生日</th>
            <th>描述</th>
        </tr>
        <%
            PetDao petDao = new PetDaoImpl();
            List<Pet> pets = petDao.findAll();
            for (Pet pet : pets) {
        %>
        <tr>
            <td><%= pet.getPetId() %></td>
            <td><%= pet.getPetName() %></td>
            <td><%= pet.getPetBreed() %></td>
            <td><%= pet.getPetSex() %></td>
            <td><%= pet.getBirthday() %></td>
            <td><%= pet.getDescription() %></td>
        </tr>
        <%
            }
        %>
    </table>
    <br>
    <a href="addPet.jsp">添加宠物</a>
</body>
</html>

